package com.china.great.system.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @Author: Liu HongYang
 * @DateTime: 2020/5/4 7:04 下午
 * @Description: TODO
 */
@Data
public class SystemLoginUser implements UserDetails,Serializable {

    private long id;
    private String username;
    private String password;
    //private String roles;


    public SystemLoginUser(long id,String username, String password) {
        this.id = id;
        this.username = username;
        this.password = password;
    }

    //public SystemLoginUser(String username, String password, String roles) {
      //  this.username = username;
        //this.password = password;
        //this.roles = roles;
    //}

    /*@Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        //List<GrantedAuthority> authorities = new ArrayList<>();
       *//* for (Role role : roles) {
            authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getAuthority()));
        }*//*
        //return authorities;
    }*/

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
